#!/usr/bin/env python
# -*- coding:utf-8 -*-
# fileName: getlog.py
import sys
import os
#sys.path.append(r"C:\Users\Administrator\PycharmProjects\ImoocAPI")
import logging.config
import logging


# 读取日志配置文件
def get_log():
    # 获取配置文件路径
    curPath = os.path.abspath(os.path.dirname(__file__))
    logPath = os.path.abspath(os.path.dirname(__file__))+"/../configs/log.conf"
    # '读取日志配置文件'
    logging.config.fileConfig(logPath, defaults={'logdir':curPath})
    # 创建一个日志器logger
    logger = logging.getLogger()
    return logger


if __name__ == "__main__":
    logger = get_log()
    logger.info('test')
